package com.cn.serverline.lineicp.produce.controller;

import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;

import com.cn.serverline.lineicp.produce.entity.dto.TeSuspendRecordsDto;
import com.cn.serverline.lineicp.produce.service.ITeSuspendRecordsService;
import io.swagger.annotations.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


@RestController
@RequestMapping("/suspendRecords")
@ApiResource(name = "挂起管理")
@Api(tags = "挂起管理")
public class SuspendRecordsController {
    @Resource(name = "teSuspendRecordsServiceImpl")
    private ITeSuspendRecordsService iTeSuspendRecordsService;

    /**
     * 添加挂起
     *
     * @param teSuspendRecords
     * @return
     */
    @PostMapping("/add")
    @ApiOperation(value = "添加挂起记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "zeroAssembly", value = "零组装，0总装，1部装", required = true, paramType = "query", dataType = "int"),
            @ApiImplicitParam(name = "teSuspendRecords", value = "挂起记录列表", required = true, dataType = "List<TeSuspendRecordsDto>", paramType = "body")
    })
    public ResponseData add(
            @RequestParam("zeroAssembly") Long zeroAssembly,
            @RequestBody @Validated List<TeSuspendRecordsDto> teSuspendRecords) {
        iTeSuspendRecordsService.add(teSuspendRecords, zeroAssembly);
        return new SuccessResponseData<>();
    }
}
